- content_for :section_title do
  = t('.title')

- content_for :title do
  = t('.title')

ruby:
  device_total = @apple_key.devices.count

.row
  .col-md-6
    .card
      .card-header
        h3.card-title = t('.team_metadata')
      .card-body.p-0
        table.table
          tr
            th = t('simple_form.labels.apple_team.display_name')
            td = link_to @apple_key.team.display_name, edit_admin_apple_team_path(@apple_key.team)
          tr
            th = t('simple_form.labels.apple_team.name')
            td = @apple_key.team.name
          tr
            th = t('simple_form.labels.apple_team.team_id')
            td = @apple_key.team.team_id
  .col-md-6
    .card
      .card-header
        h3.card-title = t('.key_metadata')
      .card-body.p-0
        table.table
          tr
            th = t('simple_form.labels.apple_key.issuer_id')
            td = @apple_key.issuer_id
          tr
            th = t('simple_form.labels.apple_key.key_id')
            td = @apple_key.key_id
          tr
            th = t('simple_form.labels.apple_key.private_key')
            td = @apple_key.encrypted_private_key

  .col-md-12
    .card
      .card-header
        h3.card-title
          = t('.devices', size: device_total)
        .card-tools
          = button_to t('.sync_now'), sync_devices_admin_apple_key_path(@apple_key), method: :put, class: 'btn btn-icon btn-success btn-sm'
      - if device_total
        .card-body.p-0
          table.table
            tr
              th = t('.udid')
              th = t('.udid_name')
              th = t('.udid_platform')
              th = t('.udid_model')
              th = t('.udid_related_apps')
              th = t('.udid_created_at')
            - @apple_key.devices.order(created_at: :desc).each do |device|
              tr
                td = link_to device.udid, udid_path(udid: device.udid)
                td = device.name
                td = device.platform
                td = device.model
                td = device.channels.count
                td = device.created_at
      .card-footer
        p
          - if @apple_key.last_synced_at.present?
            span title="#{@apple_key.last_synced_at}"
              = t('.last_synced_at', time: time_ago_in_words(@apple_key.last_synced_at))
          - else
            = t('.never_sync')
